﻿using AutoMapper;
using Material.Domain.Services;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using tianzedianzi.Controllers.System;
using Wk.System.Domain.Services;

namespace tianzedianzi.Controllers.Material
{
    public class MaterialController : BaseController
    {
        private readonly ILogger<MaterialController> _logger;
        private readonly MaterialService _materialService;
        private readonly IMapper _mapper;
        //private readonly IRestService _rest;
        public MaterialController(ILogger<MaterialController> logger, IMapper mapper, MaterialService materialService)
        {
            _logger = logger;
            _materialService = materialService;
            _mapper = mapper;
        }
        public IActionResult MaterialIndex()
        {
            return View();
        }
        [HttpPost]
        public async Task<IActionResult> GetMaterialList(int page,int limit) 
        {
            RefAsync<int> total = 0;
            var list = await _materialService.GetMaterialPageListAsync(total, page, limit);
            return LayuiPageList(data: list, count: total);
        }

    }
}
